package com.szxx.suit;

/**
 * 抽象牌型 <br>
 * 考虑牌型是个enum，用类标识便于拓展
 *
 * @author Ambrose
 */
public class AbstractSuitType implements Comparable<AbstractSuitType> {
	
	/** 默认牌型权值-1 <br>
	 * 有些子游戏中不需要比较权值，比如斗地主的单牌和对子是无法比较的
	 * 有些子游戏中需要比较权值，比如牛牛的有牛和同花顺 */
	public static final int DEFAULT_TYPE_WEIGHT = -1;

    /** 牌型对应的int值，考虑牌型是个enum */
    private final int type;//14 17
    /** 牌型权值-1 */
    private final int weight;
    
    public AbstractSuitType(int type) {
    	this(type, DEFAULT_TYPE_WEIGHT);
    }
    
    public AbstractSuitType(int type, int weight) {
		this.type = type;
		this.weight = weight;
	}
    
    @Override
	public int compareTo(AbstractSuitType o) {
    	if (o == null) {
			return 1;
		} else {
			return this.weight - o.weight;
		}
	}

    public int getType() {
        return type;
    }

	public int getWeight() {
		return weight;
	}

	@Override
	public String toString() {
		return getClass().getSimpleName() + " [type=" + type + ", weight=" + weight + "]";
	}
	
}
